<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #progress {
            width: 100%;
            height: 20px;
            margin-bottom: 10px;
            background: lightyellow;
        }

        #div {
            width: 0%;
            height: 18px;
            margin-top: 10px;
            background: green;
        }
    </style>
    <script>
        var temp = 0;
        function action() {
            document.getElementById("div").style.width = (++temp)+"%";
        }
    </script>
</head>
<body>
<h3>JavaScript 进度条</h3>
<div id="progress">
    <div id="div"></div>
</div>
<input type="button" id=“btn” value="点我" onclick="action()">
</body>
</html>